package com.fanqie.springboot2.mongo.controller;

import com.fanqie.springboot2.mongo.entity.ExceptionLog;
import com.fanqie.springboot2.mongo.service.ExceptionLogService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author php
 * @date 2019/4/10
 */
@RestController
@RequestMapping("/exception")
public class ExceptionLogController {

    @Resource
    private ExceptionLogService exceptionLogService;

    @PostMapping
    public ExceptionLog add(ExceptionLog exceptionLog) {
        return this.exceptionLogService.add(exceptionLog);
    }

    @DeleteMapping
    public long delete(String openId) {
        return this.exceptionLogService.delete(openId);
    }

    @PutMapping
    public void update(ExceptionLog exceptionLog) {
        this.exceptionLogService.findAndModify(exceptionLog);
    }

    @GetMapping
    public List<ExceptionLog> findAll() {
        return this.exceptionLogService.findAll();
    }
}
